package gwc.Business;




import gwc.DAO.DingdanDAO;
import gwc.DAO.GwcDAO;
import gwc.DAO.UsersDAO;
import gwc.Model.Dingdan;
import gwc.Model.Gwc;
import gwc.Model.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class SaleService {
    GwcDAO gwcDAO;
    DingdanDAO dingdanDAO;
    UsersDAO usersDAO;

    @Autowired
    public void setDingdanDAO(DingdanDAO dingdanDAO){
        this.dingdanDAO = dingdanDAO;
    }

    @Autowired
    public void setUsersDAO(UsersDAO usersDAO) {this.usersDAO = usersDAO; }

    @Autowired
    public void setGwcDAO(GwcDAO gwcDAO) {
        this.gwcDAO = gwcDAO;
    }
//购物车相关功能
    public void insert(Gwc gwc){ gwcDAO.insertGwc(gwc); }

    @Transactional
    public void Gwcdelete(Gwc g) { gwcDAO.deleteGwc(g); }
    public void Gwcinsert(Gwc g) { gwcDAO.insertGwc(g); }
    public void Dingdaninsert(Gwc g) { gwcDAO.insertDingdan(g);}
    public void Gwcmodify(Gwc g) { gwcDAO.modifyGwc(g); }
    public void Gwcqueryxiaoliang(Gwc g) { gwcDAO.queryGwcxiaoliang(g);}
    public void jia(Gwc g){ gwcDAO.jia(g);}
    public void jian(Gwc g){ gwcDAO.jian(g);}
    public Gwc Gwcquery(Gwc g) {System.out.println(gwcDAO.queryGwc(g));return gwcDAO.queryGwc(g); }

    public float zj(){ System.out.println(gwcDAO.zj()); return gwcDAO.zj();}
    public List<Gwc> GwcqueryAll() {System.out.println(gwcDAO.queryAll()); return gwcDAO.queryAll(); }


//订单相关功能

    @Transactional
    public List<Dingdan> DingdanqueryAll() {System.out.println(dingdanDAO.queryAll()); return dingdanDAO.queryAll(); }

//用户相关功能
    @Transactional
    public void Usersmodify(Users users) { usersDAO.modifyUsers(users);}
    public Users Usersquery(Users users) {System.out.println(usersDAO.queryUsers(users)); return usersDAO.queryUsers(users);}

    public List<Users> UsersqueryAll() { System.out.println(usersDAO.queryAll()); return usersDAO.queryAll();}
}
